<template>
   <!-- <view @click.stop="$emit('click', item)">
        <image class="comimng" :src="$lz.cdn(item.meta.cover, 3)" mode="widthFix"></image>
        <view class="title">{{ item.meta.title }}</view>
        <view>
            <text class="tip" v-for="tag in item.meta.tags">{{ tag }}</text>
        </view>
        <view class="money">
            ￥
            <text class="moneyN">{{ selectedSku.salePrice }}</text>
            <text class="cost">￥{{ selectedSku.marketPrice }}</text>
        </view>
    </view> -->
	<view @click.stop="$emit('click', item)">
	    <image class="comimng" :src="$lz.cdn(item.meta.cover, 3)" mode="widthFix"></image>
	    <view class="title">{{ item.meta.title }}</view>
	    <view>
	        <text class="tip" v-for="tag in item.meta.tags">{{ tag }}</text>
	    </view>
	    <view class="money">
	        ￥
	        <text class="moneyN">{{ selectedSku.salePrice }}</text>
	        <text class="cost">￥{{ selectedSku.marketPrice }}</text>
	    </view>
	</view>
</template>

<script>
export default {
    name: 'lz-goods-card-item',
    props: {
        item: {
            type: Object,
            default: () => {}
        }
    },
    data() {
        return {
            is_init: true,
            specMeta: [],
            skuMeta: [],
            selectedSku: {},
            defaultSkuImage: ''
        };
    },
    watch: {
        item: {
            handler: function ({ meta, spec_meta, sku_meta }) {
                this.defaultSkuImage = meta.cover;
                this.specMeta = spec_meta;
                if (spec_meta && sku_meta) {
                    // console.log(spec_meta, sku_meta);
                    this.skuMeta = sku_meta;
                    this.checkDefaultSku();
                }
            },
            deep: true,
            immediate: true
        },
        selectedSku(value) {
            console.log('value', value);
            this.$emit('select', value);
        }
    },
    methods: {}
};
</script>

<style scoped lang="scss">
.comimng {
    width: 100%;
}
.title {
    margin: 16rpx;
    color: #00091a;
    font-size: 32rpx;
}
.tip {
    font-size: 20rpx;
    color: #3377ff;
    padding: 8rpx;
    border-radius: 8rpx;
    margin-right: 16rpx;
    background: #f7faff;
}
.money {
    margin-top: 8rpx;
    color: #ff6401;
    font-size: 20rpx;
    .moneyN {
        font-size: 32rpx;
        font-weight: bold;
    }
    .cost {
        font-size: 24rpx;
        color: #ccced1;
        text-decoration: line-through;
        margin-left: 8rpx;
    }
}
</style>
